<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>barmodel</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="bamboo.html" title="bamboo" />
    <link rel="next" href="bbcutm.html" title="bbcutm" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">barmodel</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="bamboo.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="bbcutm.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="barmodel"></a>
      <div class="titlepage"></div>
      <a id="IndexBarmodel" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">barmodel</span>
        </h2>
        <p>barmodel — 
      Creates a tone similar to a struck metal bar.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp91458816"></a>
        <h2>Description</h2>
        <p>
      Audio output is a tone similar to a struck metal bar, using a
    physical model developed from solving the partial differential
    equation.  There are controls over the boundary conditions as
    well as the bar characteristics.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp91460224"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>barmodel</strong></span> kbcL, kbcR, iK, ib, kscan, iT30, ipos, ivel, iwid</pre>
      </div>
      <div class="refsect1">
        <a id="idp91462304"></a>
        <h2>Initialization</h2>
        <p>
    <span class="emphasis"><em>iK</em></span> -- dimensionless stiffness parameter.  If
    this parameter is negative then the initialisation is skipped and
    the previous state of the bar is continued.
    </p>
        <p>
    <span class="emphasis"><em>ib</em></span> -- high-frequency loss parameter (keep this small).
    </p>
        <p>
    <span class="emphasis"><em>iT30</em></span> -- 30 db decay time in seconds.
    </p>
        <p>
    <span class="emphasis"><em>ipos</em></span> -- position along the bar that the strike occurs.
    </p>
        <p>
    <span class="emphasis"><em>ivel</em></span> -- normalized strike velocity.
    </p>
        <p>
    <span class="emphasis"><em>iwid</em></span> -- spatial width of strike.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp91468400"></a>
        <h2>Performance</h2>
        <p>
      A note is played on a metalic bar, with the arguments as below.
    </p>
        <p>
      <span class="emphasis"><em>kbcL</em></span> -- Boundary condition at left end of
    bar (1 is clamped, 2 pivoting and 3 free).
    </p>
        <p>
      <span class="emphasis"><em>kbcR</em></span> -- Boundary condition at right end of
    bar (1 is clamped, 2 pivoting and 3 free).
    </p>
        <p>
      <span class="emphasis"><em>kscan</em></span> -- Speed of scanning the output location.
    </p>
        <p>
      Note that changing the boundary conditions during playing may
  lead to glitches and is made available as an experiment.  The use of
  a non-zero <span class="emphasis"><em>kscan</em></span> can give apparent re-introduction of sound due to
  modulation.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp91473424"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the barmodel opcode. It uses the file <a class="ulink" href="examples/barmodel.csd" target="_top"><em class="citetitle">barmodel.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp91475280"></a>
          <p class="title">
            <strong>Example 78. Example of the barmodel opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o barmodel.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
  <span class="ohdr">sr</span>        <span class="op">=</span>           44100
  <span class="ohdr">kr</span>        <span class="op">=</span>           4410
  <span class="ohdr">ksmps</span>     <span class="op">=</span>           10
  <span class="ohdr">nchnls</span>    <span class="op">=</span>           1

<span class="comment">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  aq        <span class="opc">barmodel</span>    1, 1, p4, 0.001, 0.23, 5, p5, p6, p7
            <span class="opc">out</span>         aq
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>


<span class="stamnt">i</span>1 0.0 0.5  3 0.2 500  0.05
<span class="stamnt">i</span>1 0.5 0.5 -3 0.3 1000 0.05
<span class="stamnt">i</span>1 1.0 0.5 -3 0.4 1000 0.1
<span class="stamnt">i</span>1 1.5 4.0 -3 0.5 800  0.05
<span class="stamnt">e</span>
/* barmodel */

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp91479568"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Stefan Bilbao </td>
          </tr>
          <tr>
            <td>University of Edinburgh, UK</td>
          </tr>
          <tr>
            <td>Author: John ffitch </td>
          </tr>
          <tr>
            <td>University of Bath, Codemist Ltd.</td>
          </tr>
          <tr>
            <td>Bath, UK</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 5.01</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="bamboo.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="bbcutm.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">bamboo </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> bbcutm</td>
        </tr>
      </table>
    </div>
  </body>
</html>
